﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RazorDemo2.Models;

namespace RazorDemo2.Controllers
{
    public class HomeController : Controller
    {
        private Product _product;
        private List<Product> _products;

        public HomeController()
        {
            _product = new Product
            {
                ProductId=1,
                Name="Kayak",
                Description="单人船",
                Category = "水上运动",
                Price=275m
            };
            _products = new List<Product>()
            {
                new Product { Name="足球",Price=12m},
                new Product { Name = "足球", Price = 12m },
                new Product { Name = "足球", Price = 12m },
                new Product { Name = "足球", Price = 12m },
                new Product { Name = "足球", Price = 12m },
                new Product { Name = "足球", Price = 12m },
            };
        }
        // GET: Home
        public ActionResult Index()
        {
            ViewBag.ProductCount = 1;
            ViewBag.ApplyDiscount = false;
            ViewBag.ExpressShip = true;
            ViewBag.Supplier = null;
            ViewData["greeting"] = "Hello world";
            ViewBag.Products = _products;
            return View("Index",_product);
        }
    }
}